﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;

namespace Pavilion.DesignerTool.ViewTools
{
    public class NumericTextBox : TextBox
    {
        protected override void OnPreviewTextInput(System.Windows.Input.TextCompositionEventArgs e)
        {
            if (e.Text != "-" && e.Text != ".")
            {
                try { Convert.ToInt32(e.Text); }
                catch { e.Handled = true; }
            }

            base.OnPreviewTextInput(e);
        }
    }
}
